
const data_config = require("./data_config");


module.exports = {
  nav_name: '商品库管理', //生成导航菜单
  module_name: 'cur_goods_m',  //生成路径，必须与文件名相同
  api: `{
    page: commonPath + "/admin/shopgood/page", //分页
    detail: commonPath + '/admin/shopgood/get', //详情,
    add: commonPath + '/admin/shopgood/add', //添加
    del: commonPath + '/admin/shopgood/del', //删除
    edit: commonPath + '/admin/shopgood/update', //修改
    changeState: commonPath + '/admin/shopgood/editState', //状态

    changePuxiaoPrice: cPath + "/admin/shopgood/editPxPrice", //修改普消价格
    changeYiWuPrice: cPath + "/admin/shopgood/editYwPrice", //修改易物价格
  }`, //接口
  //列表
  table: {
    isGenerate: "false", //false表示不生成页面
    table_name: "cur_goods_m_table",  //表页面名
    nav_name: "商品库列表",  //导航名
    tipsText: "商品库管理 >> 商品库列表", //顶部文字
    // tableReqMethod: "get",  //分页请求配置成get方式, 默认为post
    // pageApi: "API.sys_setting.sys_setting_page",  //请求api
    // extraPageRequestParams: `
    //   courseId: this.$route.query.id,  //请求
    // `, //已有page和pageSize
    
    //获取列表页面
    tableData: [
      //普通
      { title: '序号', name: 'index', type: "normal" },
      { title: '商品名', name: 'name', type: "normal", itemWidth: "200" },
      {
        title: '类型',
        name: 'type',
        type: "opts",
        showName: "typeShow",
        showObj: `{
          "1": "普消",
          "2": "易物",
        }`
      },
      { title: '一级分类编码', name: 'catCode', type: "normal" },
      { title: '二级分类编码', name: 'superCode', type: "normal" },
      { title: '三级分类编码', name: 'classCode', type: "normal" },
      { title: '品牌', name: 'brandName', type: "normal" },
      { title: '成本价', name: 'floorPrice', type: "normal" },
      { title: '京东价格', name: 'price', type: "normal" },
      {
        title: '商品主图',
        name: 'imagePath',
        type: "img",
        heightVal: "60",
        widthVal: "100",
      },
      { title: '库存', name: 'inventory', type: "normal" },
      {
        title: '状态',
        name: 'state',
        type: "opts",
        showName: "stateShow",
        showObj: `{
          "1": "上架",
          "2": "下架",
        }`
      },
    ],
    tableOpt: [
      //编辑跳转
      {
        type: "modify",
        text: "编辑",
        request: false,
        jump: "/cur_goods_m_add_cur_goods"
      },
      
      {
        type: "changeState",
        text: "上架",
        request: true,
        url: "API.cur_goods_m.changeState",
        requestType: 'post',
        params: `{id,  state: 1 }`, //必须为文本 状态 1上架 2下架
        methodNameTag: 'Open', //方法衔接拓展名 changeState Black
        showCondition: `scope.row.state == '2'`,  //展示条件，没有就不传或置为空
      },
      {
        type: "changeState",
        text: "下架",
        request: true,
        url: "API.cur_goods_m.changeState",
        requestType: 'post',
        params: `{id,  state: 2 }`, //必须为文本
        methodNameTag: 'Close', //方法衔接拓展名 changeState Black
        showCondition: `scope.row.state == '1'`,  //展示条件，没有就不传或置为空
      },
      //删除功能
      {
        type: "del",
        text: "删除",
        request: true,
        url: "API.cur_goods_m.del",
        requestType: 'get',
        // isSplitSearchString: 'true',  //拼接查询字符串（post需要，get不需要）。
      },
    ],
    search: {
      contentArr: {
        input1: { labelName: '商品名称', inputName: 'name' },
        select1: {
          labelName: '类型',
          inputName: 'type',  //输入绑定的变量
          selectOptsName: "typeOpts",
          selectOptsArr: `[
            { value: "1", label: "普消" },
            { value: "2", label: "易物" },
            { value: "", label: "请选择" },
          ],
          `, //选项数组
        },
        select2_1: {
          labelName: '一级分类',
          inputName: 'catCode',  //输入绑定的变量
          selectOptsName: "catCodeOpts",
          selectOptsArr: `[
            { value: "", label: "请选择" },
          ],
          `, //选项数组
        },
        select2_2: {
          // labelWidth: "120",
          labelName: '二级分类',
          inputName: 'superCode',  //输入绑定的变量
          selectOptsName: "superCodeOpts",
          selectOptsArr: `[
            { value: "", label: "请选择" },
          ],
          `, //选项数组
        },
        select2_3: {
          labelName: '三级分类',
          inputName: 'classCode',  //输入绑定的变量
          selectOptsName: "classCodeOpts",
          selectOptsArr: `[
            { value: "", label: "请选择" },
          ],
          `, //选项数组
        },
      },
      //查找按钮的文字
      searchBtn: {
        text: "查询", //链接与table请求接口相同，不做另外配置
      },
      //添加按钮
      addBtn: {
        //搜索栏具有添加功能按钮时，设置此字段
        type: "add",
        text: "新增商品",
        request: false,
        jump: "/cur_goods_m_add_cur_goods", //添加的跳转按钮
      }
    },
  },


  //添加商品页面
  add_page: {
    isGenerate: "false", //false表示不生成页面
    add_page_name: "add_cur_goods",  //尽量短些,要拼接路由
    tipsText: "商品库管理 >> 商品添加",
    // pageApi: "API.sys_setting.sys_setting_page",  //请求api
    formData: {
      titleText: "请填写商品信息",
      input1: {
        labelName: '商品名称',
        inputName: 'name',
        isNeed: 'true',
        // disabled: 'true', //为true时禁用
      },
      select1: {
        labelName: '类型',
        inputName: 'type',  //输入绑定的变量
        selectOptsName: "typeOpts",
        selectOptsArr: `[
            { value: "1", label: "普消" },
            { value: "2", label: "易物" },
          ],
          `, //选项数组
        isNeed: 'true',
      },
      
      input8_11: {
        labelName: '品牌',
        inputName: 'brandName',
        // isNeed: 'true',
      },
      //成本价为必传
      input2: {
        labelName: '成本价',
        inputName: 'floorPrice',
        isNeed: 'true',
      },
      input3: {
        labelName: '京东价格',
        inputName: 'price',
        // isNeed: 'true',
      },

      input4: {
        labelName: '卖出价',
        inputName: 'sellingPrice',
        isNeed: 'true',
      },
      input5: {
        labelName: '库存',
        inputName: 'inventory',
        // isNeed: 'true',
      },

      select6: {
        labelName: '状态',
        inputName: 'state',  //输入绑定的变量
        selectOptsName: "stateOpts",
        selectOptsArr: `[
            { value: "1", label: "上架" },
            { value: "2", label: "下架" },
          ],
          `, //选项数组
        isNeed: 'true',
      },


      //图片上传
      uploadImg1_1: {
        labelName: "商品主图",
        inputName: "imagePath",
        type: "many", //type: "single"
        countLimit: "1",
        uploadMethod: "handleUpload_1",
        isNeed: 'true',
      },

      uploadImg1_2: {
        labelName: "商品副图",
        inputName: "figurePath",
        type: "many", //type: "single"
        countLimit: "1",
        uploadMethod: "handleUpload_2",
        // isNeed: 'true',
      },

      uploadImg1_3: {
        labelName: "所有详情页照片",
        inputName: "images",
        type: "many", //type: "single"
        countLimit: "1",
        uploadMethod: "handleUpload_3",
        // isNeed: 'true',
      },

      input8_1: {
        labelName: '中评度',
        inputName: 'generalRate',
        // isNeed: 'true',
      },
      input8_2: {
        labelName: '好评度',
        inputName: 'goodRate',
        // isNeed: 'true',
      },
      //富文本
      //富文本组件 富文本组件添加默认背景
      richText1: {
        labelName: '详情页',
        inputName: 'introduction',
        isNeed: 'true',
        minHeight: "180", //高度
        uploadApi: "API.common.upload",
        editContentChangeMethodName: "handleBgEditChange", //改变方法
        // isNeed: 'true',
      },
      input8_4: {
        labelName: '物流费用',
        inputName: 'logisticsFees',
        // isNeed: 'true',
      },
      input8_5: {
        labelName: '规格',
        inputName: 'param',
        // isNeed: 'true',
      },
      input8_6: {
        labelName: '产地',
        inputName: 'productArea',
        // isNeed: 'true',
      },
      input8_7: {
        labelName: '单位',
        inputName: 'saleUnit',
        // isNeed: 'true',
      },
      // input8_8: {
      //   labelName: '商品编码',
      //   inputName: 'sku',
      //   // isNeed: 'true',
      // },
      input8_9: {
        labelName: '描述',
        inputName: 'wareQd',
        // isNeed: 'true',
      },
      input8_10: {
        labelName: '重量',
        inputName: 'weight',
        // isNeed: 'true',
      },
      input8_12: {
        labelName: '商品评分',
        inputName: 'averageScore',
        // isNeed: 'true',
      },

      //一级分类
      select9_1: {
        labelName: '一级分类',
        inputName: 'catCode',  //输入绑定的变量
        selectOptsName: "catCodeOpts",
        selectOptsArr: `[
            { value: "", label: "一级分类" },
          ],
          `, //选项数组
        // isNeed: 'true',
      },
      select9_2: {
        labelName: '二级分类',
        inputName: 'superCode',  //输入绑定的变量
        selectOptsName: "superCodeOpts",
        selectOptsArr: `[
            { value: "", label: "二级分类" },
          ],
          `, //选项数组
        // isNeed: 'true',
      },
      select9_3: {
        labelName: '三级分类',
        inputName: 'classCode',  //输入绑定的变量
        selectOptsName: "classCodeOpts",
        selectOptsArr: `[
            { value: "", label: "三级分类" },
          ],
          `, //选项数组
        // isNeed: 'true',
      },

      //三级select
      // input7_1: {
      //   labelName: '库存',
      //   inputName: 'inventory',
      //   isNeed: 'true',
      // },
      // input7_2: {
      //   labelName: '库存',
      //   inputName: 'inventory',
      //   isNeed: 'true',
      // },
      // input7_3: {
      //   labelName: '库存',
      //   inputName: 'inventory',
      //   isNeed: 'true',
      // },
    },
    addBtn: {
      text: '添加',
      url: "API.cur_goods_m.add",
      // extraParams: ` courseId: Number(this.$route.query.courseId), `, //请求的额外参数
      jumpPath: "/cur_goods_m_cur_goods_m_table",
      // extraQueryParams: ` { id: this.$route.query.courseId } `, //跳转时携带参数
    }, //
    editBtn: {
      text: '编辑',
      detailUrl: "API.cur_goods_m.detail", //默认get方式请求
      // detailType: 'get', //请求方式
      isSplitSearchString: 'true', //拼接查询字符串, get和post的必须字段
      // extraParams: ` courseId: Number(this.$route.query.courseId), `, //请求的额外参数
      editUrl: "API.cur_goods_m.edit",
      jump: '/cur_goods_m_cur_goods_m_table'
    },
    cancelBtn: { text: "取消" }, //
    //额外请求
    extraRequest: {
      dataCode: [
        "catCodeOpts"
      ],
      methodsCode: [
        {
          explainText: "一级分类获取", //说明
          type: "opts",  //表示选项类型格式，value, label
          methodName: "getSort_1",
          api: "API.jd_sort_m.page",
          optsName: "catCodeOpts",
          params: `{
            "pageIndex": 1,
            "pageSize": 10000,

          }`,
          optsConfig: {
            label: "className",
            value: "id"
          },
        }
      ]
    },
  },

}

